package com.example.material

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.example.material.databinding.ActivityMainBinding
import com.example.material.util.launchActivity

class MainActivity : AppCompatActivity() {
    private lateinit var binding: ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        binding = ActivityMainBinding.inflate(layoutInflater)
        val view = binding.root
        setContentView(view)
        ViewCompat.setOnApplyWindowInsetsListener(view) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }

        initButtons()

//        launchActivity<NavigationActivity>()
//        launchActivity<ToolbarAndSoOnActivity>()
//        launchActivity<CardAndSoOnActivity>()
//        launchActivity<SwipeRefreshLayoutActivity>()
        launchActivity<CollapsingToolbarLayoutActivity>()
    }

    private fun initButtons() {
        binding.toolbarBtn.setOnClickListener {
            launchActivity<ToolbarAndSoOnActivity>()
        }
        binding.drawerLayoutBtn.setOnClickListener {
            launchActivity<DrawerLayoutActivity>()
        }
        binding.navigationBtn.setOnClickListener {
            launchActivity<NavigationActivity>()
        }
        binding.cardBtn.setOnClickListener {
            launchActivity<CardAndSoOnActivity>()
        }
        binding.swipeRefreshLayoutBtn.setOnClickListener {
            launchActivity<SwipeRefreshLayoutActivity>()
        }
        binding.collapsingToolbarLayoutBtn.setOnClickListener {
            launchActivity<CollapsingToolbarLayoutActivity>()
        }
    }
}